Store JSON object
There is a global store object in the centurionV2-vue, see /src/libs/store.js. This data is keep in sync with the backend from SSE messages. Several pages pull data from the store object. Because the object is reactive these pages redraw immediately when the object is updated by the SSE file when an update is received from the centurionV2-nodejs backend.
// store.js
import { reactive } from 'vue';
export let store = reactive({
ping: 0,
updateNeeded: false,
sseEventIds: {
syncDashboardPairs: 0,
syncDashboardLoki: 0,
syncChains: 0,
syncFeeData: 0,
syncFeeds: 0,
syncHistory: 0,
newLogRecord: 0,
syncAlertsCnt: 0
},
alertsCnt: 0,
subscriptions: {}, // important to init as JSON obj
dashboardPairs: [], // dashboard data for feed/chain pairs and timestamp
dashboardLoki: [],
chains: [], // Populates the chains page and its children
feeds: [], // Populates the feeds page and its children
width: document.documentElement.clientWidth, // The width of the browser document (window)
isAdmin: false,
clientTimeZone: new Date().toString().match(/([A-Z]+[\+-][0-9]+.*)/)[1]
});